package com.kyg.tjtoolmanager.db;

import java.util.ArrayList;
import java.util.List;

public class SQLObserver {

    private static List<SQLReaderListener> readerListeners = new ArrayList<>();

    public static void addReaderChangeListener(SQLReaderListener listener) {
        if (!readerListeners.contains(listener)) {
            readerListeners.add(listener);
        }
    }

    public static void removeReaderChangeListener(SQLReaderListener listener) {
        readerListeners.remove(listener);
    }

    public static void dispatchChange() {
        for (int i = 0; i < readerListeners.size(); i++) {
            readerListeners.get(i).onDataChange();
        }
    }

}
